﻿using System;
using System.Runtime.CompilerServices;

namespace winS.Unity.Process
{
    public struct ProcessAwaiter : INotifyCompletion
    {
        public bool IsCompleted => !processPlayState.isPlaying;

        private readonly ProcessPlayState processPlayState;

        public ProcessAwaiter(ProcessPlayState processPlayState)
        {
            this.processPlayState = processPlayState;
        }

        public void GetResult()
        {
        }

        void INotifyCompletion.OnCompleted(Action continuation)
        {
            processPlayState.continuation = continuation;
        }
    }
}
